package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/**
 * @author ly
 * @date 2021/9/29-9:11
 * @describe
 * *类名：AlipayConfig
 *  *功能：基础配置类
 *  *详细：设置帐户有关信息及返回路径
 *  *修改日期：2017-04-05
 *  *说明：
 *  *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *  *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */
public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2021000118624178";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQClUPZWZIylgY01+zyqsYQDYkVptTQXIK8xHv3knXITVBGTbyLHAbAjbnevVYy7QNd4b7YPiNYFMDkznQwBiPsTOjLNUoxnqZN5I36pBqCHZbCxGwSQ5Ry7p0l7H9rGXve08eODev4J3az8ZouYXr/JuieUi6AF4dnicScv1XrvC7RdnqZmqauwTtJVlkbnj4CejcextUbaNA78Ksw5LFZAkoiygOnVH1VdKPtsXe6fOybjfVu1A9aom2dFaBR6hfFz3WYlS/Pl9BBE1Fon72acX88hCnxPRTV966cB2nbGIZ21ROy2udwXbBEJPMKEq+Fx4rpCmAWYvT3n5VyuT7qTAgMBAAECggEBAKK+76PhXOzaey/3Y6QPGg1Sw07rippyHMZY4k4cCd+pVZw1PqF3sfVPnRfJOsBldzojj7H/XeLBtK5xHw6r0bD+DGFBsOOkd4A8R0cTNRnWLHpORNJ4Gy9J4vcJRxEfEPDbaMVZYZpI1zGrqiWYsWpgjvKX+jOQQjXAe3mFyn5lBz1tO36DggCQgEowEsBGrGfTmEd4jjcC8qWHQLMfzu/QQ4GoS0cWgRbyIzbZ7IQeXfuWYYycnlvr7KAWgElqhz+Y27ywCAEbwLIQbKwhFJzwgh+PU5R3slfLDnFF/rWb1dK9Ud+UHNqNLXzeBHe6xquBLuJi++QhbH3itoC9jkECgYEA8TKT8cLfmJk1N2RJozT8puDPZjLgM4iDnsVsiywL4hkb9tCHJMP8J1O7mKE+u6SYJvOLwQzer8QgJIBhtj49mgE0TJZLcXL13SCvAftqy+S66ABjAvq8rKL/7E3KiXrhjlRI99LOoyp1XNOUMReS9TZEsKMhNhtYSDymxqwMHwMCgYEAr3Y5Mpjr2ueaOY1Uvv7GcjujAIQfRrJt+D0t8vxRGYl/NOhVP+g8wZChzxjO/KSFrTsaHJniRfmKubgFiIqY81Rosh4d2Gmxdi7tF7/Gbbq6Ch24W1Ns2fXz0qb3adTgzSUGYbvX34zkpFiHu4S7qv/u2JLYxL+Qx0uGwJgnmTECgYBqsGGqlfWLrXFRsCW2cJC1TEnRPf3YLbFywIczxGb5OvwYn8K3q41U4//eEq0KGVNIH4CZAxVZkBpbqwINt9hNz+yPWAfFBgHlLzjaWpix2donF0y0m65reqpTn1FQoK824udn37KRkA1b4ybw1CmoF7oom+/r3Aqf4VwwExhFewKBgGhikCKu4VoJATKOB0XdcpgRLKco8yZvDodpdkWhoGnt5/TE57quYj7R2cHIQ5QAGNr3V1B+qCPzEnnspbYWpmnU5LhavGy8bGwf/MNtPxKWzQkppz0Fw7Nj5FuFI5odoGPLTCGmzAXd30R6ur1veOqBekn0Cuv5/5rhLtizbJNxAoGBALEJfXrhk8DazGpgBjZlkp9r3Gr0G7XLwBc8cg5lWbJqpPUKuxkx5zFAwcmy0sODSrqvolkqVF6vJPfARbT5T9dmIWel3XCZ0sKdYMZVWzicI0iTuFY1KyBtiBGSt8oLJgFGTt1QtB6Ul+BMPZqmLm0bLeTFq2mFP1pTVmdJOOiE";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAt3tpiUglXTgIuEXddVRDaiUN4gasEHJ7YbJccwD9eYDwOW2fZ6d1EvkIyezhsY2iKXFXH9r1o39KjsqiWIHu2PdFk9vqhw1GhC8nZt7EcSlerj2/n50t++24+/yo7bWMUEQGvvcHvpFbum3wyuvL/9goNshegAdA4z0RGrWqyn6QJXn/vMJZ0yCBqAXXNtqNGTgg1SpqgB6eQjL0POaWmWN+54gZFcY6oXMJMHliA1aZsUw/rZhAWSe6Xp9zb6zOh4STLt7FNJ/wIpcJ6Tj0UvgO0TOnCM5uzx7z5EgRS7KhSFY7U/gEkyllEWZnxuK+E2THtkzXkCzBW/OV1dPDTwIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://工程公网访问地址/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://77qizd.natappfree.cc/alipay";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
